<template>
	<picker mode="region" @change="regionChange" :value="region">
	    <view class="picker">
	      {{region[0]}},{{region[1]}},{{region[2]}}
	    </view>
	</picker>
</template>

<script>
	import * as util from '@/common/util.js'
	
	export default {
		name:"city-picker",
		data() {
			return {
				region: ['北京市', '北京市', '东城区'],
				code:[110000,110100,110101],
			};
		},
		props: {
			ori: {
				type: Object,
				default: {}
			},
		},
		created() {
			let reginData=util.tranGpsToRegin(this.ori)			
			
			this.region=reginData.region
			this.code=reginData.code
		},
		methods:{
			//选择省市
			regionChange(e){
				let region=e.detail.value
				let code=e.detail.code
				
				this.region=region
				this.code=code
				
				this.$emit("change",{code:code,region:region})
			},
		}
	}
</script>

<style>
</style>